﻿namespace ShureValidation.Language
{
    /// <summary>
    /// Wrapper around model language
    /// </summary>
    internal class ModelLanguage : IModelLanguage, ILanguagePrompts
    {
        private readonly ILanguagePrompts _prompts;
        private readonly string _modelName;

        public ModelLanguage(ILanguagePrompts prompts, string modelName)
        {
            _prompts = prompts;
            _modelName = modelName;
        }

        public virtual string this[string promptName]
        {
            get { return _prompts[_modelName, promptName]; }
        }

        /// <summary>
        /// Get a language prompt.
        /// </summary>
        /// <param name="modelName">Model to get translation for</param>
        /// <param name="promptName">Text prompt to get</param>
        /// <returns>Translation if found; otherwise "[promptName]" without the quotes.</returns>
        string ILanguagePrompts.this[string modelName, string promptName]
        {
            get { return _prompts[_modelName, promptName]; }
        }

        /// <summary>
        /// Get a language prompt.
        /// </summary>
        /// <param name="modelName">Model to get translation for</param>
        /// <param name="promptName">Text prompt to get</param>
        /// <returns>Translation if found; otherwise null.</returns>
        string ILanguagePrompts.Get(string modelName, string promptName)
        {
            return _prompts.Get(_modelName, promptName);
        }
    }
}